RERUN='(There were undefined references|Rerun to get (cross-references|the bars) right|rerunfilecheck)'
UNDEFINED='((Reference|Citation).*undefined)|(Label.*multiply defined)'

all: td1.pdf td2.pdf td3.pdf td4.pdf td5.pdf td6.pdf td7.pdf td8.pdf

%.pdf: %.tex td*.tex 
	pdflatex $<
	@if egrep -q $(RERUN) $*.log ; then echo "passe LaTeX" \
			&& pdflatex $<; fi
	@if egrep -q $(RERUN) $*.log ; then echo "passe LaTeX" \
			&& pdflatex $<; fi
	@echo "Citations ou références indéfinies:"
		@egrep -i $(UNDEFINED) $*.log || echo "Aucune"


clean :
	rm *.aux *.log *.out *.pdf
